package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;

import java.security.PublicKey;
import java.util.Date;
import java.util.List;

//用户评论对象
@Getter
@Setter
@JsonIgnoreProperties("handler")
public class UserComment extends BaseDomain {

    //文章主题的类型
    public static final Integer TYPE_TRAVEL = 1; //游记
    public static final Integer TYPE_STRATEGY = 0; //攻略
    public static final Integer TYPE_COMMENT = 2; //评论
    private String comment;//评论的内容
    @JsonFormat(pattern = "yyyy年-MM月-dd日 HH:mm:ss", timezone = "GMT+8")
    private Date commentTime;//评论我的时间
    private User user;//发起评论的人的
    private Long themeId;//在哪个主题下发起的at请求,那篇游记或攻略的id
    private boolean haseread;//被at的人是否读过,0为未读,这个部分为消息专用
    private User becommented;//被评论的人
    private Integer themeType;//文章主题的类型,0代表是攻略,1代表是游记，2是评论
    private Long usercommentId;//哪条评论的评论
    private List<UserComment> commentList = new ArrayList<> ();//该评论的评论


    //王新加的部分用来完整显示消息
    private String themeTitle;


    public String getTitleMessage() {
        String msg = null;
        if (themeType != null) {
            msg = "在";
            if (themeType.equals (TYPE_TRAVEL)) {
                msg += "游记:";
            } else {
                msg += "攻略:";
            }
            msg += themeTitle;
            msg += "中评论了我";
        }

        return msg;
    }

    public String getDestinationMsg() {
        String msg = "" + themeId + "&destination=";
        return msg + id;
    }


}